# -*- coding:utf-8 -*-
# 函数传参
import time
import threading


def func_one(name):
    while True:
        print(f"{name}正在唱歌")
        time.sleep(1)


def func_two(name, age):
    while True:
        print(f"{name}正在打游戏,{age}岁了")
        time.sleep(1)


if __name__ == '__main__':
    # 创建两个子线程t1、t2，分别执行func_one和func_two
    t1 = threading.Thread(target=func_one, args=("张三",))       # 设置守护线程
    t2 = threading.Thread(target=func_two, args=("李四", 18))       # 设置守护线程
    # 启动线程
    t1.start()
    t2.start()
    print(threading.enumerate())

    print("程序因线程一陷入阻塞")
    t1.join(timeout=3)
    print("程序因线程二陷入阻塞")
    t2.join(timeout=3)
    print("主线程已退出")
